package com.ninetaildemonfox.zdl.socialproject.mvp.ui.adapter;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.utils.CustomRoundAngleImageView;
import com.ninetaildemonfox.zdl.socialproject.utils.GlideUtils;
import com.ninetaildemonfox.zdl.socialproject.utils.RoundImageView;

import java.util.Map;

/**
 * 创建人： Nine tails fox
 * 创建时间： 2019/7/19
 * 功能描述: 图片适配器
 * 联系方式：1037438704@qq.com
 *
 * @author NineTailDemonFox
 */

public class ImageViewAdp3 extends BaseQuickAdapter<Map<String, String>, BaseViewHolder> {

    private  int count;

    public void setCount(int count) {
        this.count = count;
    }

    public ImageViewAdp3(int imageview) {
        super(imageview);
    }

    @Override
    protected void convert(BaseViewHolder helper, Map<String, String> item) {
        RoundImageView image_head = helper.itemView.findViewById(R.id.image_head);
        //焚毁
        ImageView image_burn_down = helper.itemView.findViewById(R.id.image_burn_down);
        //播放
        ImageView image_pay = helper.itemView.findViewById(R.id.image_pay);
//        "id": "4",   // 图片id
//                "is_video": 0,    //  是否是视频  0否 1是
//                "pic": "http:\/\/shejiao.txunda.com\/Uploads\/Index\/2019-07-13\/5d2930fc42787.jpg",  // 图片路径
//                "url": "",      //  视频路径
//                "is_see": "2"  // 是否设置阅后即焚  1否 2是

        if (!TextUtils.isEmpty(item.get("is_see"))){
            if (count == 1){
                // 是否设置阅后即焚 1否 2是
                if (item.get("is_see").equals("2")) {
                    //   是否看过图片  1是 2否
                    image_burn_down.setVisibility(View.VISIBLE);
                    if (item.get("have_see").equals("1")){
                        image_burn_down.setImageResource(R.mipmap.ic_head_fenhui);
                    }else {
                        image_burn_down.setImageResource(R.mipmap.ic_head_false);
                    }
                } else {
                    image_burn_down.setVisibility(View.GONE);
                }
            }else {
                if (item.get("is_see").equals("2")) {
                    image_burn_down.setVisibility(View.VISIBLE);
                } else {
                    image_burn_down.setVisibility(View.GONE);
                }
            }
        }
        if (!TextUtils.isEmpty(item.get("is_video"))){
            if (item.get("is_video").equals("1")) {
                image_pay.setVisibility(View.VISIBLE);
            } else {
                image_pay.setVisibility(View.GONE);
            }
        }
        GlideUtils.glideFille(mContext, item.get("pic"), image_head);
    }
}